Skip to content

chore(services): store observed counts in permissionsServer, add LR/LS flags#2929

Open
barakmich wants to merge 7 commits intomainfrom
barakmich/ps_counts
Open

chore(services): store observed counts in permissionsServer, add LR/LS flags#2929
barakmich wants to merge 7 commits intomainfrom
barakmich/ps_counts

Conversation

@barakmich
Copy link
Contributor

@barakmich barakmich commented Feb 28, 2026

Description

Add the "lr" and "ls" strings as inputs for --experimental-query-plan. Adds testing for the gRPC routes along with the existing consistency tests. And in so doing, found another bug: we want to combine the caveat both from the wildcard, and the relationship itself, which may or may not have one

Testing

References

@github-actions github-actions bot added area/api v1 Affects the v1 API area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools) labels Feb 28, 2026
@codecov
Copy link

codecov bot commented Feb 28, 2026

Codecov Report

❌ Patch coverage is 3.09598% with 313 lines in your changes missing coverage. Please review.
✅ Project coverage is 35.06%. Comparing base (e49cc12) to head (5ace6b9).

Files with missing lines Patch % Lines
internal/services/v1/permissions_queryplan.go 1.61% 245 Missing ⚠️
pkg/query/datastore.go 0.00% 47 Missing ⚠️
pkg/query/context.go 0.00% 14 Missing ⚠️
internal/services/v1/permissions.go 0.00% 5 Missing and 2 partials ⚠️

❌ Your project check has failed because the head coverage (35.06%) is below the target coverage (75.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (e49cc12) and HEAD (5ace6b9). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (e49cc12) HEAD (5ace6b9)
25 21
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #2929       +/-   ##
===========================================
- Coverage   74.82%   35.06%   -39.75%     
===========================================
  Files         497      430       -67     
  Lines       60656    54886     -5770     
===========================================
- Hits        45382    19243    -26139     
- Misses      12115    33724    +21609     
+ Partials     3159     1919     -1240     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@barakmich barakmich force-pushed the barakmich/ps_counts branch from e95f9b9 to 0bd1e09 Compare March 2, 2026 18:05
// This allows tracking which parts of query plans are used most frequently.
type QueryPlanMetadata struct {
mu sync.Mutex
stats map[query.CanonicalKey]query.CountStats // GUARDED_BY(mu)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we put a cap on how much this map can grow?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll grow only as the schema changes. For very large schemas, it may touch ~1000 entries. Rapidly changing large schemas with no overlap could make this grow... but I'm not worried about it. Plus, we're still behind the experimental flag and I think we'll have to come back to it.

@barakmich barakmich force-pushed the barakmich/ps_counts branch from 0bd1e09 to 01dfa21 Compare March 16, 2026 17:12
@barakmich barakmich marked this pull request as ready for review March 16, 2026 17:13
@barakmich barakmich requested a review from a team as a code owner March 16, 2026 17:13
@barakmich barakmich changed the title chore(services): store observed counts in permissionsServer chore(services): store observed counts in permissionsServer, add LR/LS flags Mar 16, 2026
@github-actions github-actions bot added the area/cli Affects the command line label Mar 16, 2026
t.Parallel()

ctx := NewTestContext(t)
ctx.Context = t.Context()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: line 23 of testutil.go is already doing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api v1 Affects the v1 API area/cli Affects the command line area/tooling Affects the dev or user toolchain (e.g. tests, ci, build tools)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants